package com.qf.fmall2202.user.controller;

import com.qf.fmall2202.user.entity.User;
import com.qf.fmall2202.user.service.UsersService;
import com.qf.fmall2202.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 用户  前端控制器
 * </p>
 *
 * @author 徐英海
 * @since 2022-11-03
 */
@RestController
@RequestMapping("/user")
@CrossOrigin
public class UsersController {
    @Autowired
    private UsersService usersService;

    @PostMapping("/regist")
    public ResultVo regist(@RequestBody User user) {
        return usersService.regist(user);
    }

    @GetMapping("/login")
    public ResultVo login(String username, String password) {
        return usersService.login(username, password);
    }
}
